package ui.swing.tree.filesystem;

import javax.swing.JComboBox;

public class MemComboBox extends JComboBox {

	private static final long serialVersionUID = 3841090100273920886L;

	public static final int MAX_MEM_LEN = 10;

	public MemComboBox() {
		super();
		setEditable(true);
	}

	// Add to history list
	public void add(String item) {
		removeItem(item);
		insertItemAt(item, 0);
		setSelectedItem(item);
		if (getItemCount() > MAX_MEM_LEN) {
			removeItemAt(getItemCount() - 1);
		}
	}
}
